package com.ant.gmap;

import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;

import com.ant.gmap.activities.MapTest001;
import com.ant.utls.base.BaseActivity;
import com.ant.utls.utils.AntLog;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends BaseActivity implements View.OnClickListener, AdapterView.OnItemClickListener {
    private ListView mlv;
    private ImageView mimg;

    private List<String> title;
    private List<Class> activity;

    private ArrayAdapter<String> adapter;


    @Override
    public int getLaout() {
        title = new ArrayList<>();
        activity = new ArrayList<>();
        return R.layout.ac_main;
    }

    @Override
    public void initView() {
        mlv = (ListView) findViewById(R.id.ac_main_lv01);
        mimg = (ImageView) findViewById(R.id.ac_main_addImage01);
    }

    @Override
    public void initData() {
        getListData();
        adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, title);
        mlv.setAdapter(adapter);
    }

    @Override
    public void initListener() {
        mlv.setOnItemClickListener(this);
        mimg.setOnClickListener(this);
    }

    public void getListData() {
        title.add("gmap test001");
        activity.add(MapTest001.class);
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ac_main_addImage01:

                break;
        }
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        AntLog.i("ant this is debug");
        startActivity(new Intent(this, activity.get(position)));
    }

}
